﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;

namespace DemoGrid
{
    public partial class ScrollGrid : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                hidInitPageNumber.Value = "2";
                hidPageRecCount.Value = ConfigurationManager.AppSettings["PageRecordCount"].ToString();
                BindGrid();
            }
        }
        private void BindGrid()
        {            
            int totalRecordCount = 0;
            int pageRecordCount = Convert.ToInt32(hidPageRecCount.Value) * 2; 
            EmployeeDAO objEmployeeDAO = new EmployeeDAO();
            IList<Employee> empList = objEmployeeDAO.GetEmployeeDetails(1, pageRecordCount, out totalRecordCount); 
            grdEmployeeDtls.DataSource = empList;
            grdEmployeeDtls.DataBind();           
            hidTotalRecCount.Value = totalRecordCount.ToString();
        }
    }
}